package cn.edu.xaut.mybatisers.mall.config;

import cn.edu.xaut.mybatisers.mall.Interceptor.LoginCheck;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class interceptorConfigurator implements WebMvcConfigurer {
    @Autowired
    LoginCheck loginCheck;

    @ApiOperation("注册拦截器")
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginCheck).addPathPatterns("/**").excludePathPatterns(
                "/login",
                "/admin/login",
                                                                                                                            "/**/register",
                "/verify/getCodePicture",
                "/**/register/user"
        );
    }
}
